package com.gwcloud.leetcode.offers;

/** 
* @ClassName   : Leetcode0580 
* @author      : ganwei 
* @date        : 2020年6月9日 
* @Description : TODO 
*/
public class Leetcode0580 {
    public String reverseWords(String s) {
    	String[] ss = s.split("\\s+");
    	StringBuilder sb = new StringBuilder();
    	for(int i = ss.length-1; i >= 0; i--) {
    		sb.append(ss[i]);
    		sb.append(" ");
    	}
    	
    	return sb.substring(0, sb.length()-1).trim();
    }
    /**
     * -主函数
     */
    public static void main(String[] args) {
    	String gg = " ";
    	String[] ggs = gg.split("\\s+");
    	for(String g : ggs) {
    		System.out.println("123");
    		System.out.println(g);
    	}
    }
}
